<template>
  <div class="block">
    <el-carousel height="150px">
      <el-carousel-item v-for="item in banner" :key="item.index">
        <img style="width:100%;height:100%" :src="item.image" @load="imageLoad"/>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>

import {getHomeMultidata} from "@/network/home"

export default {
  name:"HomeSwiper",
  data(){
    return{
      banner:[],
      isLoad: false
    }
  },
  created () {
    getHomeMultidata().then(res => {
      // console.log(res.data.banner.list)
      this.banner = res.data.banner.list
    })
  },
  methods: {
    imageLoad() {
      if(!this.isLoad){
        this.$emit('swiperImageLoad');
        this.isLoad = true
      } 
    }
  }
}
</script>

<style scoped>

</style>